package cn.arnold.offer.bilibili;

import java.util.Scanner;

/**
 * @author Arnold-Xiang
 * @Info
 */
public class Main {
    public static void main(String[] args) {
        int a = 2;
        int b = ++a;
        int c = a+b;
        int d = c++;
        String[] strs = {"024655","026548","026587"};
        System.out.println(longestCommonPrefix(strs));
        Scanner scanner = new Scanner(System.in);
        scanner.nextLine();
    }

    public static String longestCommonPrefix(String[] strs) {
        if(strs.length == 0)
            return "";
        String ans = strs[0];
        for(int i =1;i<strs.length;i++) {
            int j=0;
            for(;j<ans.length() && j < strs[i].length();j++) {
                if(ans.charAt(j) != strs[i].charAt(j))
                    break;
            }
            ans = ans.substring(0, j);
            if(ans.equals(""))
                return ans;
        }
        return ans;
    }
}
